import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { resolve } from "path";
// import Components from 'unplugin-vue-components/vite'
// https://vitejs.dev/config/
export default defineConfig({
  build: {
    target: "es2020",
  },
  resolve: {
    alias: [
      {
        find: "@",
        replacement: resolve(__dirname, "src"),
      },
    ],
  },
  // bendi
  server: {
    port: 1314,
    host: "0.0.0.0",
    // 选项写法
    proxy: {
      "/pag": {
        target: "https://cdn.tmui.design",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, "/api"),
      },
      // "/api": {
      //   target: "http://101.34.108.131:4592",
      //   changeOrigin: true,
      //   rewrite: (path) => path.replace(/^\/api/, "/api"),
      // },
    },
  },
  plugins: [uni(), vueJsx()],
});
